package com.wang.lotterysystem.common.exception;

import com.wang.lotterysystem.common.errorcode.ErrorCode;
import lombok.Data;
import lombok.EqualsAndHashCode;

// @Data 生成自己的 equals  hashcode
// 不写@EqualsAndHashCode(callSuper = true)  可能会出现问题

@Data
@EqualsAndHashCode(callSuper = true)
public class ServiceException extends RuntimeException{
    private Integer code;
    private String msg;
    public ServiceException(){

    }
    public ServiceException(Integer code,String msg){
        this.code = code;
        this.msg = msg;
    }
    public ServiceException(ErrorCode errorCode){
        this.code = errorCode.getCode();
        this.msg = errorCode.getMsg();
    }
}